import { createRouter, createWebHashHistory } from 'vue-router'

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      component: () => import('@/views/login.vue')
    }, {
      path: '/chart',
      component: () => import('@/views/stat/index.vue')
    },
    {
      path: '/',
      redirect: '/dashboard',
      component: () => import('@/layout/index.vue'),
      children: [
        // ...
        {
          path: 'dashboard',
          component: () => import('@/views/dashboard/index.vue'),
          meta: { pname: '仪表盘', name: '' }
        },
        {
          path: 'system/user',
          component: () => import('@/views/system/user/index.vue'),
          meta: { pname: '系统管理', name: '用户管理' }
        },
        {
          path: 'system/role',
          component: () => import('@/views/system/role/index.vue'),
          meta: { pname: '系统管理', name: '角色管理' }
        },
        {
          path: 'system/menu',
          component: () => import('@/views/system/menu/index.vue'),
          meta: { pname: '系统管理', name: '菜单管理' }
        },
        {
          path: 'system/dict',
          component: () => import('@/views/system/dict/index.vue'),
          meta: { pname: '系统管理', name: '字典管理' }
        },
        {
          path: 'system/log/oper',
          component: () => import('@/views/system/log/oper.vue'),
          meta: { pname: '系统管理', name: '操作日志' }
        },
        {
          path: 'system/log/login',
          component: () => import('@/views/system/log/login.vue'),
          meta: { pname: '系统管理', name: '登录日志' }
        },
        {
          path: 'system/notice',
          component: () => import('@/views/system/notice/index.vue'),
          meta: { pname: '系统管理', name: '系统消息' }
        },
        {
          path: 'monitor/online',
          component: () => import('@/views/monitor/online/index.vue'),
          meta: { pname: '系统监控', name: '在线用户' }
        },
        {
          path: 'monitor/server',
          component: () => import('@/views/monitor/server/index.vue'),
          meta: { pname: '系统监控', name: '服务监控' }
        },
        {
          path: 'monitor/cache',
          component: () => import('@/views/monitor/cache/index.vue'),
          meta: { pname: '系统监控', name: '缓存监控' }
        },
        {
          path: 'res/coursetype',
          component: () => import('@/views/res/coursetype/index.vue'),
          meta: { pname: '资源管理', name: '课程类型' }
        },
        {
          path: 'res/course',
          component: () => import('@/views/res/course/index.vue'),
          meta: { pname: '资源管理', name: '课程管理' }
        },
        {
          path: 'res/resource',
          component: () => import('@/views/res/resource/index.vue'),
          meta: { pname: '资源管理', name: '资源管理' }
        },
        {
          path: 'train/grade',
          component: () => import('@/views/train/grade/index.vue'),
          meta: { pname: '培训管理', name: '班级管理' }
        },
        {
          path: 'train/student',
          component: () => import('@/views/train/student/index.vue'),
          meta: { pname: '培训管理', name: '学员管理' }
        },
        {
          path: 'train/gradestudent',
          component: () => import('@/views/train/gradestudent/index.vue'),
          meta: { pname: '培训管理', name: '班级学员' }
        },
        {
          path: 'study/grade',
          component: () => import('@/views/study/grade/index.vue'),
          meta: { pname: '学习管理', name: '我的班级' }
        },
        {
          path: 'study/course',
          component: () => import('@/views/study/course/index.vue'),
          meta: { pname: '学习管理', name: '我的课程' }
        },
        {
          path: 'study/item',
          component: () => import('@/views/study/item/index.vue'),
          meta: { pname: '学习管理', name: '我的课件' }
        },
        {
          path: 'stat/grade',
          component: () => import('@/views/stat/grade/index.vue'),
          meta: { pname: '统计管理', name: '班级人数' }
        },
        {
          path: 'stat/role',
          component: () => import('@/views/stat/role/index.vue'),
          meta: { pname: '统计管理', name: '角色用户' }
        },
        {
          path: 'stat/type',
          component: () => import('@/views/stat/type/index.vue'),
          meta: { pname: '统计管理', name: '课程类型统计' }
        }
        // ...
      ]
    },
    {
      path: '/:pathMatch(.*)',
      component: () => import('@/views/404.vue')
    }
  ]
})

export default router
